﻿using System;
using CthulhuDomain.GameEntities;
using CthulhuDomain.Services;
using Microsoft.Pex.Framework.Validation;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Pex.Framework;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Input;
using CthulhuDomain;
using Microsoft.Xna.Framework;

namespace Invaders.Test
{
  //public partial class InvadersFixture
  //{
  //  [PexMethod]
  //  [PexAllowedException(typeof(GamerServicesNotAvailableException))]
  //  public void Score_AfterPlayerStrikeCthulhu_ShouldBeIncreasedByOwnRule()
  //  {
  //    // Act
  //    // Arrange/
  //    var time = new GameTimeAdapter(new GameTime(new TimeSpan(0, 0, 0, 10), new TimeSpan(0, 0, 0, 20)));
  //    var keys = new[] { Keys.Space };
  //    var pRecAdapter = new RectangleAdapter(0, 0, 300, 100);
  //    var mRecAdapter = new RectangleAdapter(0, 0, 300, 100);

  //    var _efactory = DomainFactory.GetFactory(DomainFactory.eTypeEntity.Cthulhu);
  //    var _matrix = new DomainEntityMatrix(_efactory, 3);

  //    var cManager = new ContentManagerAdapter(contentManager);
  //    var _pfactory = DomainFactory.GetFactory(DomainFactory.eTypeEntity.Player);
  //    var _pentity = _pfactory.CreateEntity(cManager);
  //    _matrix.LoadContent(cManager, new RectangleAdapter(0, 0, 300, 280));

  //    _pentity.Update(pRecAdapter, keys);
  //    _pentity.Move(pRecAdapter, keys);
  //    _matrix.Update(mRecAdapter, time);
  //    _pentity.Shoots[0].Position = _matrix.Matrix[2, 2].Position;
  //    var expectedResult = _matrix.Matrix[2, 2].Score;

  //    var result = CollisionManager.DetectCollision(_matrix, _pentity);
  //    ScoreManager.Update(_matrix, _pentity);
  //    // Assert

  //    Assert.AreEqual(ScoreManager.Score, expectedResult.Amount);
  //  }

  //  [PexMethod]
  //  [PexAllowedException(typeof(GamerServicesNotAvailableException))]
  //  public void Score_AfterPlayerStrikeCthulhu_ShouldBeIncreasedByOwnRuleGreatOfZero()
  //  {
  //    // Act
  //    // Arrange/
  //    var time = new GameTimeAdapter(new GameTime(new TimeSpan(0, 0, 0, 10), new TimeSpan(0, 0, 0, 20)));
  //    var keys = new[] { Keys.Space };
  //    var pRecAdapter = new RectangleAdapter(0, 0, 300, 100);
  //    var mRecAdapter = new RectangleAdapter(0, 0, 300, 100);

  //    var _efactory = DomainFactory.GetFactory(DomainFactory.eTypeEntity.Cthulhu);
  //    var _matrix = new DomainEntityMatrix(_efactory, 3);

  //    var cManager = new ContentManagerAdapter(contentManager);
  //    var _pfactory = DomainFactory.GetFactory(DomainFactory.eTypeEntity.Player);
  //    var _pentity = _pfactory.CreateEntity(cManager);
  //    _matrix.LoadContent(cManager, new RectangleAdapter(0, 0, 300, 280));

  //    _pentity.Update(pRecAdapter, keys);
  //    _pentity.Move(pRecAdapter, keys);
  //    _matrix.Update(mRecAdapter, time);
  //    _pentity.Shoots[0].Position = _matrix.Matrix[2, 2].Position;
  //    var expectedResult = _matrix.Matrix[2, 2].Score;

  //    var result = CollisionManager.DetectCollision(_matrix, _pentity);
  //    ScoreManager.Update(_matrix, _pentity);
  //    // Assert
  //    var newResult = ScoreManager.Score + expectedResult.Amount;

  //    // Assert
  //    Assert.IsTrue(newResult > 0);
  //  }
    
  //}
}
